import type { RouteRecordRaw } from 'vue-router'
import { shallowRef } from 'vue'
import { Layout } from '../constant'
import IconMenuReport from '~icons/local/menu-report-color'

// 教务数据
const edu: RouteRecordRaw = {
  path: 'edu',
  name: 'edu',
  meta: {
    title: '教务数据',
    group: true,
  },
  children: [
    {
      path: 'class/stat',
      name: 'ClassStatReport',
      component: () => import('@/views/report/edu/ClassStatReport.vue'),
      meta: {
        title: '班级三率',
        code: 'report:class:stat',
      },
    },
    {
      path: 'teacher/lesson',
      name: 'TeacherLessonReport',
      component: () => import('@/views/report/edu/TeacherLessonReport.vue'),
      meta: {
        title: '课时统计',
        code: 'report:teacher-lesson:read',
      },
    },
    {
      path: 'sell/list',
      name: 'SellRecordIndex',
      component: () => import('@/views/shop/sell/index.vue'),
      meta: {
        title: '顾问业绩明细',
        code: 'report:stat:fin',
      },
    },
    {
      path: 'sell/stat',
      name: 'SellStatReport',
      component: () => import('@/views/report/edu/SellStatReport.vue'),
      meta: {
        title: '顾问业绩统计',
        code: 'report:stat:fin',
      },
    },
  ],
}

// 财务数据
const fin: RouteRecordRaw = {
  path: 'fin',
  name: 'fin',
  meta: {
    title: '财务数据',
    group: true,
  },
  children: [
    {
      path: 'stat',
      name: 'FinStatReport',
      component: () => import('@/views/report/fin/FinStatReport.vue'),
      meta: {
        title: '收支统计',
        code: 'report:fin:stat',
      },
    },
    {
      path: '/pay/list',
      name: 'PayRecordList',
      component: () => import('@/views/report/fin/PayRecordList.vue'),
      meta: {
        title: '收款明细',
        code: 'report:fin:stat',
      },
    },
    {
      path: '/refund/list',
      name: 'RefundRecordList',
      component: () => import('@/views/report/fin/RefundRecordList.vue'),
      meta: {
        title: '退款明细',
        code: 'report:fin:stat',
      },
    },
    {
      path: 'lesson/list',
      name: 'LessonStatReport',
      component: () => import('@/views/report/fin/lesson/LessonStatReport.vue'),
      meta: {
        title: '课消统计',
        code: 'report:class:stat',
      },
    },
  ],
}

export default <RouteRecordRaw>{
  path: '/report',
  component: Layout,
  meta: {
    title: '数据报表',
    icon: shallowRef(IconMenuReport),
    sort: 5,
  },
  children: [
    edu,
    fin,
  ],
}
